import React, { useState, useTransition } from "react";

export default function UseReducerDemo() {

  const [isPending,startTransition] = useTransition();
  
  const [count,setCount] = useState(3)

  function changeCount(){
    startTransition(()=>{
      setCount(count=>count+1);
    })
  }

  return (
    
      <div>
        <h1>useTransition示例：</h1>
        <p>{isPending && <div>加载中………………</div>}</p>
        <p>count:{count}</p>
        <input type="button" value="修改count" onClick={changeCount} />
      </div>
  );
}
